home *** CD-ROM | disk | FTP | other *** search
- /* NewInspector.m by Imran Qureshi November 1991
- *
- * Copyright (C) 1991 The Board of Trustees of
- * The Leland Stanford Junior University. All Rights Reserved.
- */
-
- #import "NewInspector.h"
-
- const char NewInspector_h_rcsid[] = NEWINSPECTOR_H_ID;
- const char NewInspector_m_rcsid[] = "$Id: NewInspector.m,v 1.15 1992/04/06 00:38:26 pfkeb Rel $";
-
- #import <appkit/Box.h>
- #import <appkit/Button.h>
- #import <appkit/PopUpList.h>
- #import <appkit/Matrix.h>
-
- #import "InspectBase.h"
-
- @implementation NewInspector
-
- static id theInspector = nil;
-
- /* makes sure there is only one instantiation of this object */
- + new
- {
- if (!theInspector) {
- theInspector = self = [super new];
- [self init];
- } else
- self = theInspector;
-
- return self;
- }
-
- -init
- {
- //[super init];
-
- [NXApp loadNibSection:"NewInspector.nib" owner:self
- withNames:NO fromZone:[self zone]];
- ViewsList = [[List allocFromZone:[self zone]] init];
- SupervisorList = [[List allocFromZone:[self zone]] init];
-
-
- thePopUpList = [thePopUpListButton target];
- [thePopUpList setTarget:self];
- [thePopUpList setAction:@selector(toggleInspectorPanels:)];
- [thePopUpList removeItemAt:0];
- /* IB comes up with atleast one item in the popupList. We do this to get rid of that.*/
-
- return self;
- }
-
- -inspectorPanel
- {
- return InspectorPanel;
- }
-
- -free
- {
- [ViewsList free];
- [SupervisorList free];
- //[InspectorPanel orderOut:self];
- return [super free];
- }
- - orderFrontPanel:sender
- {
- [InspectorPanel setFloatingPanel:YES];
- [InspectorPanel orderFront:self];
- return self;
- }
- - orderBackPanel:sender
- {
- [InspectorPanel orderBack:self];
- return self;
- }
-
- -setTitle:(char *)theTitle
- {
- [InspectorPanel setTitle:theTitle];
- return self;
- }
- -addView:(id)aView withName:(char *)Name withSupervisor:(id)aSupervisor
- {
- [ViewsList addObject:aView];
- [SupervisorList addObject:aSupervisor];
-
- [thePopUpList addItem:Name];
-
- [InspectorBox setContentView:aView];
- [InspectorBox display];
-
- [thePopUpListButton setTitle:Name];
- return self;
- }
-
- -remove:(char *)Name
- {
- int i;
-
- i = [thePopUpList indexOfItem:Name];
- [thePopUpList removeItemAt:i];
- [ViewsList removeObjectAt:i];
- return self;
- }
-
- -replace:(char *)Name with:(char *)someName andView:(id)aView
- {
- int i;
-
- i = [thePopUpList indexOfItem:Name];
-
- /* if new name is desired, change the name */
- if (someName) {
- [thePopUpList removeItemAt:i];
- [ thePopUpList insertItem: someName at:i];
- }
- [ViewsList replaceObjectAt:i with:aView];
- return self;
- }
- -show:(char *)Name
- {
- int i;
-
- i = [thePopUpList indexOfItem:Name];
- [thePopUpListButton setTitle:Name];
- [InspectorBox setContentView:[ViewsList objectAt:i]];
- [InspectorBox display];
- return self;
-
- }
-
- -updateDisplay
- {
- [InspectorBox display];
- return self;
- }
- - windowDidUpdate:sender
- {
- [SupervisorList makeObjectsPerform:@selector(windowDidUpdate:) with:sender];
- return self;
- }
- -toggleInspectorPanels:sender
- {
- int i;
-
- i = [sender selectedRow];
- [[SupervisorList objectAt:i] updateView];
- [InspectorBox setContentView:[ViewsList objectAt:i]];
- [InspectorBox display];
- return self;
- }
-
-
- @end
-